﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="gridview书籍管理.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:GridView runat="server" ID="gridview1" AllowPaging="True" AutoGenerateColumns="False" OnPageIndexChanging="gridview1_PageIndexChanging" ShowFooter="True" OnRowEditing="gridview1_RowEditing" OnRowCancelingEdit="gridview1_RowCancelingEdit" OnRowDataBound="gridview1_RowDataBound" OnRowUpdating="gridview1_RowUpdating" OnRowDeleting="gridview1_RowDeleting" AllowSorting="True" OnSorting="gridview1_Sorting" >
                <Columns>
                    <asp:TemplateField HeaderText="书籍Id" SortExpression="Id" >
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lbid" Text='<%# Eval("Id") %>' />
                        </ItemTemplate>
                       
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="书籍名称" SortExpression="Title">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lbtitle" Text='<%# Eval("Title") %>' />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox runat="server" ID="txtEditTitle" Text='<%# Eval("Title") %>' ></asp:TextBox>
                        </EditItemTemplate>
                         <FooterTemplate>
                            <asp:TextBox runat="server" ID="txtTitle"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="简介" SortExpression="Descript">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lbdes" Text='<%# Eval("Descript") %>'></asp:Label>
                        </ItemTemplate>
                            <EditItemTemplate>
                            <asp:TextBox runat="server" ID="txtEditDes" Text='<%# Eval("Descript") %>' ></asp:TextBox>
                        </EditItemTemplate>
                         <FooterTemplate>
                            <asp:TextBox runat="server" ID="txtDes"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="图书分类" SortExpression="Booktype">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lbtype" Text='<%# Eval("Booktype") %>' />
                        </ItemTemplate>
                         <EditItemTemplate>
                            <asp:DropDownList runat="server"  ID="ddEditType">      
                                <asp:ListItem Text="计算机" Value="计算机"></asp:ListItem>
                                 <asp:ListItem Text="其它" Value="其它"></asp:ListItem>
                            </asp:DropDownList>
                        </EditItemTemplate>
                         <FooterTemplate>
                            <asp:DropDownList runat="server" ID="ddType">
                                <asp:ListItem Text="计算机" Value="计算机"></asp:ListItem>
                                 <asp:ListItem Text="其它" Value="其它"></asp:ListItem>
                            </asp:DropDownList>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="单价" SortExpression="Price">
                        <ItemTemplate>
                            <asp:Label runat="server" Text='<%# Eval("Price") %>' ID="labPrice"></asp:Label>
                        </ItemTemplate>
                         <EditItemTemplate>
                            <asp:TextBox runat="server" ID="txtEditPrice" Text='<%# Eval("Price") %>' ></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                               <asp:TextBox runat="server" ID="txtPrice"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="选择">
                        <ItemTemplate>
                            <asp:CheckBox runat="server" ID="chkbox"/>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:Button runat="server" ID="btnadd" Text="添加" OnClick="btnadd_Click"/>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:CommandField runat="server" ShowEditButton="True" HeaderText="操作" />
                     <asp:CommandField  runat="server" ShowDeleteButton="True" />
                   
                </Columns>

            </asp:GridView>
        </div>
      <div>
          <asp:CheckBox runat="server"  ID="chkAll" Text="全选" AutoPostBack="true" OnCheckedChanged="chkAll_CheckedChanged"/>
          <asp:Button runat="server" ID="btndelall" Text="删除" OnClick="btndelall_Click" />
      </div>
        <div>
           <asp:Button runat="server" ID="btnpricesum" Text="价格求和" OnClick="btnpricesum_Click"/> <asp:Label runat="server" ID="labsum" Text="0.00"></asp:Label>
        </div>
    </form>
</body>
</html>
